## VOID INSTALL (LUKS on LVM)
### Partitioning
Create partitions like this table: 

|Device|Size|Type|
|------|----|----|
|/dev/nvme0n1p1|512M|EFI System (1)|
|/dev/nvme0n1p2|100%G|Linux filesystem (20)|
### Encrypted volume configuration
Create encrypted volume:  
```
cryptsetup luksFormat /dev/nvme0n1p2
```
Open encrypted volume:  
```
cryptsetup luksOpen /dev/nvme0n1p2 cryptlvm
```
Create LVM volume group:  
```
vgcreate cryptgroup /dev/mapper/cryptlvm
```
Create logical volumes for the volume group **cryptgroup**:
```
lvcreate --name swap -L 4G cryptgroup
lvcreate --name root -l 100%FREE cryptgroup
```
Create file systems:  
```
mkfs.vfat /dev/nvme0n1p1
mkswap /dev/cryptgroup/swap
mkfs.ext4 /dev/cryptgroup/root
```
### System installation
Mounting:  
```
mount /dev/cryptgroup/root /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/cryptgroup/swap
```
Copy the RSA keys from the installation medium to the target root directory:
```
mkdir -p /mnt/var/db/xbps/keys
cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/
```
Install base system and other packages:
```
xbps-install -Sy -R https://repo-default.voidlinux.org/current -r /mnt base-system lvm2 cryptsetup neovim dhcpcd efibootmgr mesa-dri seatd git alacritty
```
Entering the chroot:  
```
xchroot /mnt /bin/bash
chown root:root /
chmod 755 /
```
Set root password:
```
passwd root
```
Create new user:
```
useradd -mG wheel,audio,video,input,_seatd $username
```
Set password for new user:
```
passwd $username
```
Delegate new user to superuser rights:
```
EDITOR=nvim visudo
```
Uncomment this line:
```
%wheel ALL=(ALL:ALL) ALL
```

Set hostname:
```
echo myhostname > /etc/hostname
```
Edit **/etc/hosts** file:
```
127.0.0.1        localhost
::1                    localhost
127.0.1.1        myhostname.localdomain    myhostname
```
Set language, locales and timezone:
```
echo "LANG=en_US.UTF-8" > /etc/locale.conf
ln -sf /usr/share/zoneinfo/Asia/Yekaterinburg /etc/localtime
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
```
Generate locale files with:
```
xbps-reconfigure -f glibc-locales
```
### Filesystem configuration
Edit **/etc/fstab** file like this:
```
#<file system>    <dir>    <type>    <options>                        <dump>    <pass>
tmpfs                    /tmp    tmpfs      defaults,nosuid,nodev   0                0
UUID=xxxx           /boot   vfat	     defaults	                          0	               0
UUID=xxxx           /           ext4        defaults                             0                0
UUID=xxxx           swap   swap       defaults                             0                0
```
Create a new file **/etc/dracut.conf.d/override.conf** and add **"hostonly=yes"** parametr:
```
echo "hostonly=yes" > /etc/dracut.conf.d/override.conf
```
Mount efivarfs:
```
mount -t efivarfs none /sys/firmware/efi/efivars
```
Open **/etc/default/efibootmgr-kernel-hook** and chage this parametrs:
```
MODIFY_EFI_ENTRIES=1
OPTIONS="loglevel=3 rd.luks.name=<LUKS root UUID>=cryptlvm rd.lvm.vg=cryptgroup root=/dev/cryptgroup/root rw quiet"
DISK="/dev/disk/by-uuid/xxxx"
```
Open **/etc/kernel.d/post-install/50-efibootmgr** and comment last line:
```
#efibootmgr -qo $bootorder
```
Change **fnmode** for keyboard:
```
echo "options hid_apple nfmode=2" > /etc/modprobe.d/hid_apple.conf
```
Generate the kernel and efi entry:
```
xbps-reconfigure -fa
```
### Final steps
```
exit
umount -R /mnt
reboot
```













